Skip to content

feat(select): add scrollToSelected prop#96

Merged
wangdicoder merged 1 commit intomasterfrom
feat/select-scroll-to-selected
Apr 7, 2026
Merged

feat(select): add scrollToSelected prop#96
wangdicoder merged 1 commit intomasterfrom
feat/select-scroll-to-selected

Conversation

@wangdicoder
Copy link
Copy Markdown
Owner

Summary

  • Add scrollToSelected prop to Select component (default true) that automatically scrolls the dropdown to the first selected option when opened
  • Uses a callback ref on the dropdown <ul> to reliably detect when the Portal-rendered content is mounted, then sets scrollTop via requestAnimationFrame
  • Works for both single and multiple select modes, and both options prop and children rendering paths

Release

  • Bump type: minor
  • Affected packages: @tiny-design/react (+ @tiny-design/icons, @tiny-design/tokens via fixed version group)

Test plan

  • Unit tests pass (pnpm --filter @tiny-design/react test -- --testPathPattern=select)
  • Verified in browser: left Select (default) scrolls to Option 25 on open
  • Verified in browser: right Select (scrollToSelected={false}) starts from Option 1
  • Verify docs render correctly in both English and Chinese
  • Verify existing Select demos are unaffected

🤖 Generated with Claude Code

@wangdicoder wangdicoder merged commit 4fdb8a0 into master Apr 7, 2026
1 check passed
@wangdicoder wangdicoder deleted the feat/select-scroll-to-selected branch April 7, 2026 21:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant